﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;


namespace peonwar
{
    public class ButtonTimed : Button
    {
        public Timer Countdown; // Temps requis pour pouvoir reactiver le bouton
        private Texture2D UpText;
        public int buttonID;
        public bool Available;

        public ButtonTimed(Vector2 position, Texture2D texture, Timer chrono, int ID)
            : base(position, texture, 0)
        {
            Countdown = chrono;
            UpText = GameTexture.EmptyButton;
            buttonID = ID;
            Available = false;
        }

        public override void Draw(SpriteBatch spriteBatch)
        {
            base.Draw(spriteBatch);
            if (Countdown.Duration - Countdown.ElapsedTime > 0)
                spriteBatch.Draw(UpText, new Rectangle((int)(Position.X - Texture.Width / 2), (int)(Position.Y - Texture.Height / 2), (int)((Countdown.Duration - Countdown.ElapsedTime) * Texture.Width / Countdown.Duration), Texture.Height), new Color(70, 70, 70, 150));
        }
    }
}
